<?php

class SrsBaseAction extends AgaviAction
{
	public function isSecure()
	{
		return true;
	}

	/**
	 * @param  string $id
	 * @param  string|array<string> $fields
	 * @param  string $message
	 * @return SrsBaseAction
	 */
	protected function addError($id, $fields, $message)
	{
		$incident = new AgaviValidationIncident(null, AgaviValidator::ERROR);
		$incident->addError(new AgaviValidationError($message, $id, (array)$fields));

		$this->container->getValidationManager()->addIncident($incident);

		return $this;
	}

  protected function debug($message)
  {
    if (AgaviConfig::get('core.use_logging', false))
    {
      $this->context->getLoggerManager()->getLogger('debug')->log(
        new AgaviLoggerMessage($message, AgaviLogger::DEBUG)
      );
    }
  }

	/**
	 * @param  string $name
	 * @return Doctrine_Table
	 */
	protected function getTable($name)
	{
		return Doctrine::getTable($name);
 	}

	protected function forward404()
	{
		return array(AgaviConfig::get('actions.error_404_module'), AgaviConfig::get('actions.error_404_action'));
	}
}